package controller;

import service.FileMeta;

import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DELL
 * Date: 2023-07-01
 * Time: 19:43
 */
public class ConsoleClient {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入要扫描的路径 : ");
        String basePath = scanner.next();

        // 针对该路径初始化扫描
        SearchController searchController = new SearchController();
        searchController.init(basePath);
        while (true) {
            System.out.println("输入要查询文件的关键词 : ");
            String key = scanner.next();
            // 根据关键词进行查找
            List<FileMeta> fileMetas = searchController.search(key);
            System.out.println("-------------");
            for(FileMeta fileMeta : fileMetas) {
                System.out.println(fileMeta.getPath() + File.separator + fileMeta.getName());
            }
            System.out.println("-------------");
        }

    }
}
